home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3028 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: ix.netcom.com!netnews
  2. From: bcarter@ix.netcom.com(Robert Carter )
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: VC++ v.4.0 conversion problems
  5. Date: 21 Jan 1996 18:12:40 GMT
  6. Organization: Netcom
  7. Message-ID: <4dtvmo$lak@ixnews2.ix.netcom.com>
  8. References: <4dls1n$ldp@eagle.novo.dk>
  9. NNTP-Posting-Host: pas-ca10-06.ix.netcom.com
  10. X-NETCOM-Date: Sun Jan 21 10:12:40 AM PST 1996
  11.  
  12. In <4dls1n$ldp@eagle.novo.dk> morb@novo.dk (Morten Brun) writes: 
  13. >
  14. >I am having a lot of problems when compiling under v.4. as I am etting
  15. >
  16. >a lot of conversions errors due to the new behavior of v.4 like:
  17. >----------------------------------------------------------------------
  18. ------
  19. >LPWSTR                    lpszName;
  20. >
  21. >GetPrivateProfileStringA("x", "y", "",lpszName, sizeof(lpszName),
  22. >\\xxx.INI");
  23. >
  24. >error c26664: cannot convert parm. 4 from unsigned short * to char *
  25. >----------------------------------------------------------------------
  26. ----------
  27. >or
  28. >error C2446: '=' : no conversion from 'char *' to 'unsigned char *'
  29. >error C2664: 'wcstombs' : cannot convert parameter 1 from 'unsigned
  30. >char [32]' error C2664: 'mbstowcs' : cannot convert parameter 2 from
  31. >'unsigned char *' to 'const char *'
  32. >error C2664: 'ctime' : cannot convert parameter 1 from 'unsigned long
  33. >*' to 'const long *'
  34. >----------------------------------------------------------------------
  35. -----------------
  36. >As I am e new to C++ and VC++ I have serious trouble in getting these
  37. >functions to work. Are there anybody which please could give me some
  38. >good ideas of how I without to much work can get my program to work ??
  39. >
  40. >Regards Morten
  41. >
  42. >
  43. >
  44. >Morten Brun
  45. >Novo Nordisk IT, Denmark
  46. >morb@novo.dk
  47. >
  48. The problem is with the LPWSTR. This is a Long Pointer to Wide STRing.
  49. It is for UNICODE stuff - two bytes per char.
  50. The "A" GetPrivateProfileStringA is for ASCII - one byte for char.
  51. You are asking to use a UNICODE string with an ASCII version of the
  52. routine.
  53. If you are using UNICODE through your program you need to include a
  54. define (check the conditional on the definition of
  55. GetPrivateProfileString - I don't have it in front of me)
  56. in the Program Settings. Then the header file for
  57. GetPrivateProfileString will define it to GetPrivateProfileW or the
  58. Unicode version.
  59. If a program is not ALL UNICODE or ASCII then you will need to use the
  60. UNICODE <-> ASCII conversion functions.
  61.  
  62. Hope this helps,
  63. Bob Carter
  64. bcarter@netcom.com
  65.  
  66.  
  67.